/**
 *
 */
package de.cbf.cam.dsa.item.model.entities;

import java.util.List;

import de.cbf.cam.dsa.item.model.entities.constants.QualityConstants;
import de.cbf.cam.dsa.item.model.entities.helper.Shapeness;
import de.cbf.util.uuidheader.entities.NamedEntity;

/**
 * @author Nebelritter
 *
 */
public class Item extends NamedEntity {

	public static final int PI_WEIGHT 				=  10;
	public static final int PI_DESCRIPTION 			=  11;
	public static final int PI_TYPE 				=  12;
	public static final int PI_QUALITY_CURRENT 		=  13;
	public static final int PI_QUALITY_MIN			=  14;
	public static final int PI_QUALITY_MAX 			=  15;
	public static final int PI_DIRTINESS_LEVELS		=  16;
	public static final int PI_BROKENNESS_LEVELS	=  17;
	public static final int PI_DIRTINESS			=  18;
	public static final int PI_BROKENNESS			=  19;


	public static final String PN_WEIGHT 			= "weight";
	public static final String PN_DESCRIPTION 		= "description";
	public static final String PN_TYPE 				= "type";
	public static final String PN_QUALITY_CURRENT 	= "quality.current";
	public static final String PN_QUALITY_MIN		= "quality.min";
	public static final String PN_QUALITY_MAX 		= "quality.max";
	public static final String PN_DIRTINESS_LEVELS	= "levels.dirtiness";
	public static final String PN_BROKENNESS_LEVELS	= "levels.brokenness";
	public static final String PN_DIRTINESS			= "fDirtiness";
	public static final String PN_BROKENNESS		= "fBrokenness";


	protected Float 	fWeight;
	protected String 	fDescription;
	protected String 	fType;
	protected Shapeness fDirtiness;
	protected Shapeness fBrokenness;

	/**
	 * the quality of the item, just how well it was made, not the shape it is in(well made, but broken is possible)
	 */
	protected Double fQuality;

	/**
	 * the min quality that the item exists in
	 */
	protected Double fQualityMin;
	/**
	 * the max quality that the item exists in
	 */
	protected Double fQualityMax;


	public Item() {
	}

	public Item(String name) {
		this.fName			= name;
	}

	protected void init(){
		fName			= "";
		fDescription	= "";
		fWeight 		= 0f;
		fDirtiness 		= new Shapeness();
		fBrokenness 	= new Shapeness();
		fQuality 		= QualityConstants.QUALITY_COMMON;
		fQualityMin 	= QualityConstants.QUALITY_REALLY_BAD;
		fQualityMax 	= QualityConstants.QUALITY_EXCEPTIONAL;
	}

	public String dirtyItem(Integer level, List<String> reasons){
		fDirtiness.incShapenessLevelBy(level, reasons);
		return fDirtiness.getCurrentShapenessDescription();
	}

	public String cleanItem(Integer level, List<String> reasons){
		fDirtiness.decShapenessLevelBy(level, reasons);
		return fDirtiness.getCurrentShapenessDescription();
	}

	public String breakItem(Integer level, List<String> reasons){
		fBrokenness.incShapenessLevelBy(level, reasons);
		return fBrokenness.getCurrentShapenessDescription();
	}

	public String fixItem(Integer level, List<String> reasons){
		fBrokenness.decShapenessLevelBy(level, reasons);
		return fBrokenness.getCurrentShapenessDescription();
	}

	public List<String> getDirtinessDescriptions() {
		return fDirtiness.getShapenessDescriptions();
	}

	public void setDirtinessDescriptions(List<String> shapenessDescriptions) {
		fDirtiness.setShapenessDescriptions(shapenessDescriptions);
	}

	public List<String> getBrokenessDescriptions() {
		return fBrokenness.getShapenessDescriptions();
	}

	public void setBrokenessDescriptions(List<String> shapenessDescriptions) {
		fBrokenness.setShapenessDescriptions(shapenessDescriptions);
	}

	public String getDescription() {
		return fDescription;
	}

	public void setDescription(String description) {
		this.fDescription = description;
	}

	public Float getWeight() {
		return fWeight;
	}

	public void setWeight(Float weight) {
		this.fWeight = weight;
	}

	public String getType() {
		return fType;
	}

	public void setType(String type) {
		this.fType = type;
	}

	public Double getQuality() {
		return fQuality;
	}

	public void setQuality(Double quality) {
		this.fQuality = quality;
	}

	public Double getQualityMin() {
		return fQualityMin;
	}

	public void setQualityMin(Double minQuality) {
		this.fQualityMin = minQuality;
	}

	public Double getQualityMax() {
		return fQualityMax;
	}

	public void setQualityMax(Double maxQuality) {
		this.fQualityMax = maxQuality;
	}

	public Shapeness getDirtiness() {
		return fDirtiness;
	}

	public void setDirtiness(Shapeness dirtiness) {
		this.fDirtiness = dirtiness;
	}

	public Shapeness getBrokenness() {
		return fBrokenness;
	}

	public void setBrokenness(Shapeness brokenness) {
		this.fBrokenness = brokenness;
	}


}
